1 00:00:00,600 --> 00:00:00,840 All right. 2 00:00:00,840 --> 00:00:06,510 So we have one more thing that we got to fix on our data store, on our saving data. 3 00:00:06,510 --> 00:00:06,900 Right. 4 00:00:06,900 --> 00:00:14,340 We we check to see if our data was not successful, kicking the player, hoping to preserve the data 5 00:00:14,340 --> 00:00:14,730 store. 6 00:00:14,730 --> 00:00:20,700 We didn't want to save off bad data, but when we kick the player, the player removing will fire. 7 00:00:20,700 --> 00:00:23,340 We could possibly save off bad data. 8 00:00:23,340 --> 00:00:25,710 So let's handle that situation. 9 00:00:25,710 --> 00:00:30,780 And it's also going to lead into other information that I want to save on the player that's not going 10 00:00:30,780 --> 00:00:32,310 to be leaderboard centric. 11 00:00:32,700 --> 00:00:39,180 Let's go underneath where we do all of our leaderboard stuff on ad board, and I'm going to make another 12 00:00:39,180 --> 00:00:40,740 folder local. 13 00:00:40,950 --> 00:00:44,040 I'm going to call this player info. 14 00:00:44,820 --> 00:00:47,310 I'm going to say, instance dot new. 15 00:00:47,310 --> 00:00:49,140 This is going to be a folder. 16 00:00:49,140 --> 00:00:57,030 We're going to put it on the player and let's give player info dot name. 17 00:00:57,030 --> 00:01:00,870 I'm going to make this all lowercase in the spirit of the leader stats. 18 00:01:00,870 --> 00:01:06,750 I don't like to make things that are in the workspace lowercase, but that's what they do. 19 00:01:06,750 --> 00:01:14,610 So I'm going to call this player info and then on player info, I'm going to put a variable for bad 20 00:01:14,610 --> 00:01:24,060 data, whether it's good or bad, let's say local, more of a flag, bad data equals instance new. 21 00:01:24,660 --> 00:01:31,320 It's going to be a boolean value that's going to be on player info. 22 00:01:32,220 --> 00:01:36,090 We'll give it a name by data dot name. 23 00:01:36,510 --> 00:01:42,960 And I think I'm going to go with the spirit of the things that are on the leader board with the capital 24 00:01:42,960 --> 00:01:43,560 letter. 25 00:01:43,560 --> 00:01:45,120 I'm not going to use the camel case. 26 00:01:45,120 --> 00:01:46,500 I'm going to use a space. 27 00:01:46,500 --> 00:01:49,290 I'm going to say bad data. 28 00:01:51,210 --> 00:01:51,750 All right. 29 00:01:51,750 --> 00:01:55,020 And then we'll give it we'll initialize a value of false. 30 00:01:55,020 --> 00:01:59,280 We're going to start out assuming the data is good and we're going to leave it like that unless they 31 00:01:59,280 --> 00:02:00,930 get kicked on that initialize. 32 00:02:00,930 --> 00:02:08,160 So bad data equals false, it should be good, but there could be a case where it's bad. 33 00:02:08,160 --> 00:02:10,140 So we come down to initialize data. 34 00:02:10,140 --> 00:02:12,480 The P call is unsuccessful. 35 00:02:12,510 --> 00:02:21,990 We're going to come in here, we're going to say player dot player info and then our player info. 36 00:02:23,640 --> 00:02:30,270 We have to use the square brackets with the speech quotes because we call this bad data. 37 00:02:32,040 --> 00:02:35,190 Dot value is now true. 38 00:02:35,190 --> 00:02:39,630 It's bad data because we got kicked because this was unsuccessful. 39 00:02:39,870 --> 00:02:41,610 Let's copy this. 40 00:02:42,910 --> 00:02:44,290 Control C. 41 00:02:45,090 --> 00:02:48,090 Let's go down to where we're saving the data. 42 00:02:49,950 --> 00:02:55,710 Let's say, if not bad data, then we'll save. 43 00:02:58,080 --> 00:03:03,710 And then else let's do a format format document. 44 00:03:03,720 --> 00:03:04,650 There we go. 45 00:03:05,680 --> 00:03:06,450 Else. 46 00:03:06,460 --> 00:03:11,350 Let's do a little print out, letting letting us know that there was a problem. 47 00:03:11,830 --> 00:03:12,670 Print. 48 00:03:13,810 --> 00:03:20,890 The data was corrupted, not saving. 49 00:03:24,850 --> 00:03:25,300 There. 50 00:03:25,300 --> 00:03:26,510 That should work. 51 00:03:26,530 --> 00:03:28,780 Let's give it a try to make sure we can play. 52 00:03:28,780 --> 00:03:29,210 Okay? 53 00:03:29,230 --> 00:03:30,160 We can get our data. 54 00:03:30,160 --> 00:03:31,330 Let's go to view. 55 00:03:31,330 --> 00:03:32,710 Let's go to output. 56 00:03:33,070 --> 00:03:34,570 Hit the play button. 57 00:03:35,020 --> 00:03:38,050 Now we have some we have some data already saved. 58 00:03:38,560 --> 00:03:40,780 Cannot write unreachable. 59 00:03:40,780 --> 00:03:43,030 The data was corrupted. 60 00:03:43,030 --> 00:03:45,700 Not saving are. 61 00:03:46,930 --> 00:03:50,230 Maybe it's because. 62 00:03:51,550 --> 00:03:53,440 Game settings. 63 00:03:54,400 --> 00:03:55,600 Look at that. 64 00:03:57,020 --> 00:04:01,130 Now enable studio access to API services. 65 00:04:01,930 --> 00:04:03,520 We fixed our problem. 66 00:04:03,530 --> 00:04:05,200 Now let's try it. 67 00:04:10,700 --> 00:04:11,690 Look at that. 68 00:04:11,690 --> 00:04:12,920 We got our data. 69 00:04:12,920 --> 00:04:15,590 We had an unsuccessful attempt of getting in. 70 00:04:15,620 --> 00:04:17,200 We didn't mess anything up. 71 00:04:17,210 --> 00:04:19,060 It said that the data was bad. 72 00:04:19,070 --> 00:04:21,440 Now we're back in, Everything's happy. 73 00:04:21,440 --> 00:04:26,300 We don't have to rage about our our bad data, our loss of data. 74 00:04:26,300 --> 00:04:31,370 Like if you had 1000 day streak or something and then it was gone, that would be sad. 75 00:04:31,370 --> 00:04:31,910 All right. 76 00:04:31,910 --> 00:04:34,610 So I think I'll do Daily Streak next. 77 00:04:34,610 --> 00:04:36,320 Let's go ahead and get started.